﻿<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>文档信息新增</title>
	<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
	
	<script src="../../js/scripts/boot.js" type="text/javascript"></script>
		<script src="../../js/fileupload/swfupload/swfupload.js" type="text/javascript"></script>
	
	<style type="text/css">
		html, body {
			margin: 0;
			padding: 0;
			border: 0;
			width: 100%;
			height: 100%;
			overflow: hidden;
		}
	</style>
</head>
<body>

<form id="form1">
	<div style="padding-left:11px;padding-bottom:5px;">
	  	<input name="id" id="id" class="mini-hidden" />
		<table style="table-layout:fixed;">
			<tr>
				<td align="center" style="width:80px;">审批状态</td>
				<td style="width:150px;">
					<input name="check" class="mini-combobox"
					 data='[{ "id": "1", "text": "通过"}, { "id": "2", "text": "不通过" }]'
					 value="1" textField="text" valueField="id" style="width: 100%; display: inline-block;" />
				</td>
			</tr>
			<tr>
				<td align="center">审批意见</td>
				<td><input id="advice" name="advice" class="mini-textarea"/></td>
			</tr>
		</table>
	</div>
    <div style="text-align:center;padding:10px;">               
           <a class="mini-button" onclick="onOk" style="width:60px;margin-right:20px;">保存</a>       
           <a class="mini-button" onclick="onCancel" style="width:60px;">取消</a>       
    </div>
</form>


	<script type="text/javascript">
		var userId = '<%= session.getAttribute("userId")%>';
		mini.parse();

        var form = new mini.Form("form1");
        function SaveData() {
            var data = form.getData();
            data["checkMan"] = userId;
            $.ajax({
                url: "/document/file/checkFile.do",
		        type: 'post',
                data: data,
                cache: false,
                success: function (text) {
                	if(text)alert("审批成功");
                    CloseWindow("check");
                },
                error: function (jqXHR, textStatus, errorThrown) {
                    alert(jqXHR.responseText);
                    CloseWindow();
                }
            });
        }
        function SetData(data) {
        	if(data.action == "check") {
                //跨页面传递的数据对象，克隆后才可以安全使用
                data = mini.clone(data);
				mini.get("id").setValue(data.id);
        	}
        }
        function CloseWindow(action) {            
            if (action == "close" && form.isChanged()) {
                if (confirm("数据被修改了，是否先保存？")) {
                    return false;
                }
            }
            if (window.CloseOwnerWindow) return window.CloseOwnerWindow(action);
            else window.close();            
        }
        function onOk() {
        	SaveData();
        }
        function onCancel(e) {
            CloseWindow("cancel");
        }

        function GetData() {
            var o = form.getData();
            return o;
        }
	</script>

</body>
</html>